﻿using System.Drawing;
using ThoughtWorks.QRCode.Codec;

namespace TY.UT.QrCode.ThoughtWorks
{
    /// <summary>
    /// 二维码操作
    /// </summary>
    public class QrCodeHelper
    {
        /// <summary>
        /// 生成二维码
        /// </summary>
        /// <param name="strContent"></param>
        /// <returns></returns>
        public static Image CreateQrCode(string strContent)
        {
                QRCodeEncoder qrCode = new QRCodeEncoder
                {
                    QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE,
                    QRCodeScale = 32,
                    QRCodeVersion = 8,
                    QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
                };
                Image image = qrCode.Encode(strContent);
                return image;
        }
    }
}
